//
//  IMFacility.m
//  massage
//
//  Created by 李志权 on 2017/1/20.
//  Copyright © 2017年 李志权. All rights reserved.
//

#import "IMFacility.h"
#import "IMFacilityCell.h"
@interface IMFacility ()<UITableViewDelegate,UITableViewDataSource>
{
    UITableView *_tableView;
    NSMutableArray *tableData;
}
@end

@implementation IMFacility

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title =@"我的设备";
    _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, Width, Highly)];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    _tableView.rowHeight = 115;
    _tableView.separatorStyle = NO;
    [self.view addSubview:_tableView];
    
    tableData = [NSMutableArray array];
    
    UIView *aView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, Width, 115)];
    UIButton *addNewFacility = [UIButton buttonWithType:UIButtonTypeCustom];
    addNewFacility.backgroundColor = GreenColor;
    addNewFacility.frame = CGRectMake(20, 38, Width-40, 40);
    [addNewFacility setTitle:@"添加新设备" forState:UIControlStateNormal];
    [addNewFacility setShearRound:10 masksToBounds:YES borderWidth:0 borderColor:nil];
    [addNewFacility addTarget:self action:@selector(addNewFacilityClick) forControlEvents:UIControlEventTouchUpInside];
    [aView addSubview:addNewFacility];
    _tableView.tableFooterView = aView;
    // Do any additional setup after loading the view.
}
- (void)addNewFacilityClick
{
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (tableData && tableData.count) {
        return tableData.count;
    }
    return 10;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellID = @"IMFacilityCellID";
    IMFacilityCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (!cell) {
        [tableView registerNib:[UINib nibWithNibName:@"IMFacilityCell" bundle:nil] forCellReuseIdentifier:cellID];
        cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    }
    return cell;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
